/*******************************************************************************
 *                                                                             *
 * Square3D Engine                                                             *
 * (C) 2010 Aviral Dasgupta <aviraldg@gmail.com>                               *
 *                                                                             *
 *******************************************************************************
 * Model.cpp                                                                   *
 ******************************************************************************/

#include <string>

#include "Model.h"

Model::Model(std::string id)
{
	this->id = id;
}

Model *Model::load()
{
	static ResourceManager *rm = ResourceManager::getInstance();
	ResourceID modelFile = rm->get(RM_MODEL, id);
	unsigned char *modelData=rm->getBinData(modelFile);
	{
		
	}
	rm->free(modelFile);
	return this;
}

void Model::draw(Vec3<float> position)
{
	glPushMatrix();
	glLoadIdentity();
	glBegin(GL_TRIANGLES);
		for(int tri=0; tri < this->tri_count; tri++)
		{
			glVertex(this->tris[tri]->v[0].x, this->tris[tri]->v[0].y,
				this->tris[tri]->v[0].z);
			glVertex(this->tris[tri]->v[1].x, this->tris[tri]->v[1].y,
				this->tris[tri]->v[1].z);
			glVertex(this->tris[tri]->v[2].x, this->tris[tri]->v[2].y,
				this->tris[tri]->v[2].z);
		}
	glEnd();
	glPopMatrix();
}

